<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="created" content="2018-10-23T06:18:10.521000000">
    <meta name="changed" content="2018-10-23T06:18:42.262000000">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Language" content="de">
    <title>Bibliotheken austauschen
    </title>
    <link rel="stylesheet" type="text/css" href="../../style.css">
  </head>
  <body>
    <div class="maindiv">

<h1>Bibliotheken austauschen</h1>

<p>Now suppose we have two Logisim circuits that are supposed to do the same thing.
As an instructor, you might have had students complete an assignment:
You have one file containing your solution, but you have several student files
containing their work. Maybe the assignment was to build a two-bit adder.</p>

<p>I'll imagine that we have two files, named <tt>adder-master.circ</tt>
and <tt>adder-query.circ</tt>. Each file contains a circuit named
<q>2-bit adder</q> (it's important that the circuit to test be named exactly the same),
whose appearance is the following.</p>

<blockquote><table><tbody>
<tr><td><tt>adder-master.circ</tt></td>
    <td><tt>adder-query.circ</tt></td></tr>
<tr><td><img src="../../../../img-guide/verify-adder-master.png"></td>
    <td><img src="../../../../img-guide/verify-adder-query.png"></td></tr>
</tbody></table></blockquote>

<p>As you can see, the master circuit uses Logisim's built-in adder, 
while the query circuit uses two subcircuits representing a half adder and
a full adder (which themselves are built up of simple gates).
For the purpose of our example, the query circuit has a stupid error:
The carry from the half adder is not connected into the full adder.</p>

<p>We build our testing circuit into a different file. There, we load
<tt>adder-master.circ</tt> as a Logisim Library
(Project &gt; Load Library &gt; Logisim Library…), and we insert its
2-bit adder as a subcircuit. We could execute this circuit directly to get
the desired output for a perfect solution.</p>

<blockquote><tt>java&nbsp;-jar&nbsp;logisim-filename.jar&nbsp;adder-test.circ&nbsp;-tty&nbsp;table</tt></blockquote>

<p>But we want to execute the circuit using <tt>adder-query.circ</tt>
rather than <tt>adder-master.circ</tt> as the loaded library.
The naive approach would be to open Logisim and load that library instead;
or you might simply remove the <tt>adder-master.circ</tt> file and rename
<tt>adder-query.circ</tt> to be named <tt>adder-master.circ</tt> instead.
But Logisim includes a handy <q><tt>-sub</tt></q> option that temporarily replace
one file by another during that session — without making any changes on disk.</p>

<blockquote><tt>java&nbsp;-jar&nbsp;logisim-filename.jar&nbsp;adder-test.circ&nbsp;-tty&nbsp;table&nbsp;-sub&nbsp;adder-master.circ&nbsp;adder-query.circ</tt></blockquote>

<p>The output you would see from this is shown below; it is of course different
from what we saw in <a href="index.html">the previous section</a> since now it is
executing using the erroneous <tt>adder-query.circ</tt>.</p>

<blockquote><pre>00      00      0E0
01      00      0E1
10      00      EE0
11      00      EE1
00      01      0E1
01      01      0E0
10      01      EE1
11      01      EE0
00      10      EE0
01      10      EE1
10      10      1E0
11      10      1E1
00      11      EE1
01      11      EE0
10      11      1E1
11      11      1E0</pre></blockquote>

<p><strong>Next:</strong>&nbsp;<a href="other.html">Other verification options</a>.</p>
</div></body></html>
